package cn.kgc.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author: mosin
 * @version: v1.0  2022/7/6
 * 控制层
 */
@Controller
@RequestMapping("user")  //
public class UserController {

    //登录   http://localhost:8080/mvc/user/login  返回值 String  表示返回视图的路径
    //  get  post 都可以处理   method[] 指定请求方式  log
    @RequestMapping("login")
    //@RequestMapping(value ={"login","log"} ,method ={RequestMethod.GET,RequestMethod.POST} )
    //@GetMapping("login")
    //@GetMapping()
    public  String   login(){

        System.out.println("登录请求被接收");

        return "index";   //  返回视图  转发 默认   重定向
    }

    //注册
    @RequestMapping(value = "register",method = RequestMethod.POST)
    //@PostMapping("register")
    //@PostMapping()
    public  String   register(){
        System.out.println("注册请求被接收");
        return "index";
    }

}
